package SSF.OS.NetFlow.Filter;

import com.renesys.raceway.DML.*;
import java.util.*;

/**
 * SetRange
 * this Range class uses a set as reference. Just check whether given data is
 * in the set or not.
 */
public class SetRange implements Range
{
    private HashSet set=null;

    /** in SetRange, this config does nothing */
    public void config(Configuration cfg, byte dataType)
	throws configException
    {
	//-- actually nothing need to be done for this kind of range
    }

    /** 
     * Assigne the hash set to be used. 
     * It must be called before using this range
     */
    public void useSet(HashSet hSet)
    {
	set = hSet;
    }

    /** check whether data is in the set or not */
    public boolean inRange(Object data, byte dataType)
    {
	if (set!=null)
	    return set.contains(data);
	else  {
	    System.err.println("Warning: no set is assigned for SetRange");
	    return false;
	}
    }
}
